package com.dc.designPattern._11_proxy.extend.extend1;

/**
 * Description: 代理者_游戏代理
 * @author: gdc
 * @date: 2021/6/24
 * @version 1.0
 */
public class GamePlayerProxy implements IGamePlayer {

    /**
     * 目标对象，通过接口完成聚合
     */
    private IGamePlayer gamePlayer;

    /**
     * 代理对象的构造函数，直接完成对被代理对象的初始化
     * @param name          被代理对象需要用到的参数
     */
    public GamePlayerProxy(String name) {
        this.gamePlayer = new GamePlayer(this, name);
    }

    @Override
    public void login(String user, String pwd) {
        this.gamePlayer.login(user, pwd);
    }

    @Override
    public void killBoss() {
        this.gamePlayer.killBoss();
    }

    @Override
    public void upgrade() {
        this.gamePlayer.upgrade();
    }
}
